﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Ninject.Core;
using Ninject.Core.Behavior;
using Milkify.Interfaces;
using Milkify.Views;

namespace Milkify
{
    class MilkifyViewsModule : StandardModule
    {
        public override void Load()
        {
            Bind<IViewContainer>().To<MainWindow>().Using<SingletonBehavior>();
            Bind<IMainWindowView>().To<MainWindow>().Using<SingletonBehavior>();

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type type in assembly.GetTypes())
                {
                    if (type != typeof(IMainWindowView) && MilkifyViewFactory.IsView(type))
                        Bind(type).ToSelf().Using<TransientBehavior>();
                }
            }
        }
    }
}
